package com.jeesite.modules.inventory.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import java.util.Date;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.math.BigDecimal;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 存货档案Entity
 * @author 码脑洞
 * @version 2025-04-13
 */
@Table(name="t_inventory", alias="a", label="存货档案信息", columns={
		@Column(name="auto_id", attrName="autoId", label="主键", isPK=true),
		@Column(name="org_id", attrName="orgId", label="组织ID", isQuery=false),
		@Column(name="org_code", attrName="orgCode", label="组织编码", isQuery=false),
		@Column(name="org_name", attrName="orgName", label="组织名称", isQuery=false),
		@Column(name="inventory_class_id", attrName="inventoryClassId", label="分类ID"),
		@Column(name="inv_code", attrName="invCode", label="料品编码"),
		@Column(name="inv_name", attrName="invName", label="料品名称", queryType=QueryType.LIKE),
		@Column(name="inv_add_code", attrName="invAddCode", label="存货代码", isQuery=false),
		@Column(name="inv_spec", attrName="invSpec", label="规格型号", isQuery=false),
		@Column(name="start_date", attrName="startDate", label="启用时间", isQuery=false),
		@Column(name="end_date", attrName="endDate", label="停用时间", isQuery=false),
		@Column(name="inv_attribute", attrName="invAttribute", label="存货属性", isQuery=false),
		@Column(name="package_qty", attrName="packageQty", label="包装数量", isQuery=false, isUpdateForce=true),
		@Column(name="over_qty", attrName="overQty", label="完工超额量", isQuery=false, isUpdateForce=true),
		@Column(name="over_rate", attrName="overRate", label="完工超额比例", isQuery=false, isUpdateForce=true),
		@Column(name="brand", attrName="brand", label="产地/厂牌", isQuery=false),
		@Column(name="inv_master_unit_group_id", attrName="invMasterUnitGroupId", label="库存主单位", comment="库存主单位(组)", isQuery=false, isUpdateForce=true),
		@Column(name="inv_master_unit_id", attrName="invMasterUnitId", label="库存主单位", isQuery=false, isUpdateForce=true),
		@Column(name="inv_unit_group_id", attrName="invUnitGroupId", label="库存单位", comment="库存单位(组)", isQuery=false, isUpdateForce=true),
		@Column(name="inv_unit_id", attrName="invUnitId", label="库存单位", isQuery=false, isUpdateForce=true),
		@Column(name="sales_unit_group_id", attrName="salesUnitGroupId", label="销售单位", comment="销售单位(组)", isQuery=false, isUpdateForce=true),
		@Column(name="sales_unit_id", attrName="salesUnitId", label="销售单位", isQuery=false, isUpdateForce=true),
		@Column(name="purchase_unit_group_id", attrName="purchaseUnitGroupId", label="采购单位", comment="采购单位(组)", isQuery=false, isUpdateForce=true),
		@Column(name="purchase_unit_id", attrName="purchaseUnitId", label="采购单位", isQuery=false, isUpdateForce=true),
		@Column(name="price_unit_group_id", attrName="priceUnitGroupId", label="计价单位", comment="计价单位(组)", isQuery=false, isUpdateForce=true),
		@Column(name="price_unit_id", attrName="priceUnitId", label="计价单位", isQuery=false, isUpdateForce=true),
		@Column(name="produce_unit_group_id", attrName="produceUnitGroupId", label="生产单位", comment="生产单位(组)", isQuery=false, isUpdateForce=true),
		@Column(name="produce_unit_id", attrName="produceUnitId", label="生产单位", isQuery=false, isUpdateForce=true),
		@Column(name="material_unit_group_id", attrName="materialUnitGroupId", label="领料单位", comment="领料单位(组)", isQuery=false, isUpdateForce=true),
		@Column(name="material_unit_id", attrName="materialUnitId", label="领料单位", isQuery=false, isUpdateForce=true),
		@Column(name="cost_unit_group_id", attrName="costUnitGroupId", label="成本单位", comment="成本单位(组)", isQuery=false, isUpdateForce=true),
		@Column(name="cost_unit_id", attrName="costUnitId", label="成本单位", isQuery=false, isUpdateForce=true),
		@Column(name="weight_unit_group_id", attrName="weightUnitGroupId", label="重量单位", comment="重量单位(组)", isQuery=false, isUpdateForce=true),
		@Column(name="weight_unit_id", attrName="weightUnitId", label="重量单位", isQuery=false, isUpdateForce=true),
		@Column(name="inv_unit_weight", attrName="invUnitWeight", label="库存单位重量", isQuery=false, isUpdateForce=true),
		@Column(name="bulk_unit_group_id", attrName="bulkUnitGroupId", label="体积单位", comment="体积单位(组)", isQuery=false, isUpdateForce=true),
		@Column(name="bulk_unit_id", attrName="bulkUnitId", label="体积单位", isQuery=false, isUpdateForce=true),
		@Column(name="inv_unit_bulk", attrName="invUnitBulk", label="库存单位体积", isQuery=false, isUpdateForce=true),
		@Column(name="inv_min_qty", attrName="invMinQty", label="库存-最低库存", isQuery=false, isUpdateForce=true),
		@Column(name="inv_max_qty", attrName="invMaxQty", label="库存-最大库存", isQuery=false, isUpdateForce=true),
		@Column(name="inv_safe_qty", attrName="invSafeQty", label="库存-安全库存", isQuery=false, isUpdateForce=true),
		@Column(name="warehouse_id", attrName="warehouseId", label="库存-默认仓库", isQuery=false, isUpdateForce=true),
		@Column(name="warehouse_position_id", attrName="warehousePositionId", label="库存-默认库位", isQuery=false, isUpdateForce=true),
		@Column(name="batch_flag", attrName="batchFlag", label="是否批次管理", isQuery=false),
		@Column(name="length", attrName="length", label="附加-长", isQuery=false, isUpdateForce=true),
		@Column(name="width", attrName="width", label="附加-宽", isQuery=false, isUpdateForce=true),
		@Column(name="height", attrName="height", label="附加-高", isQuery=false, isUpdateForce=true),
		@Column(name="volume", attrName="volume", label="附加-单位体积", isQuery=false, isUpdateForce=true),
		@Column(name="source_type", attrName="sourceType", label="来源", comment="来源: 1.手工新增 2.ERP", isQuery=false),
		@Column(name="source_id", attrName="sourceId", label="来源ID", isQuery=false),
		@Column(includeEntity=DataEntity.class),
	}, orderBy="a.update_date DESC"
)
public class Inventory extends DataEntity<Inventory> {
	
	private static final long serialVersionUID = 1L;
	private Long autoId;		// 主键
	private Long orgId;		// 组织ID
	private String orgCode;		// 组织编码
	private String orgName;		// 组织名称
	private Long inventoryClassId;		// 分类ID
	private String invCode;		// 料品编码
	private String invName;		// 料品名称
	private String invAddCode;		// 存货代码
	private String invSpec;		// 规格型号
	private Date startDate;		// 启用时间
	private Date endDate;		// 停用时间
	private String invAttribute;		// 存货属性
	private Integer packageQty;		// 包装数量
	private BigDecimal overQty;		// 完工超额量
	private BigDecimal overRate;		// 完工超额比例
	private String brand;		// 产地/厂牌
	private Long invMasterUnitGroupId;		// 库存主单位(组)
	private Long invMasterUnitId;		// 库存主单位
	private Long invUnitGroupId;		// 库存单位(组)
	private Long invUnitId;		// 库存单位
	private Long salesUnitGroupId;		// 销售单位(组)
	private Long salesUnitId;		// 销售单位
	private Long purchaseUnitGroupId;		// 采购单位(组)
	private Long purchaseUnitId;		// 采购单位
	private Long priceUnitGroupId;		// 计价单位(组)
	private Long priceUnitId;		// 计价单位
	private Long produceUnitGroupId;		// 生产单位(组)
	private Long produceUnitId;		// 生产单位
	private Long materialUnitGroupId;		// 领料单位(组)
	private Long materialUnitId;		// 领料单位
	private Long costUnitGroupId;		// 成本单位(组)
	private Long costUnitId;		// 成本单位
	private Long weightUnitGroupId;		// 重量单位(组)
	private Long weightUnitId;		// 重量单位
	private BigDecimal invUnitWeight;		// 库存单位重量
	private Long bulkUnitGroupId;		// 体积单位(组)
	private Long bulkUnitId;		// 体积单位
	private BigDecimal invUnitBulk;		// 库存单位体积
	private BigDecimal invMinQty;		// 库存-最低库存
	private BigDecimal invMaxQty;		// 库存-最大库存
	private BigDecimal invSafeQty;		// 库存-安全库存
	private Long warehouseId;		// 库存-默认仓库
	private Long warehousePositionId;		// 库存-默认库位
	private String batchFlag;		// 是否批次管理
	private BigDecimal length;		// 附加-长
	private BigDecimal width;		// 附加-宽
	private BigDecimal height;		// 附加-高
	private BigDecimal volume;		// 附加-单位体积
	private String sourceType;		// 来源: 1.手工新增 2.ERP
	private String sourceId;		// 来源ID

	public Inventory() {
		this(null);
	}
	
	public Inventory(String id){
		super(id);
	}
	
	@JsonSerialize(using = ToStringSerializer.class)
	public Long getAutoId() {
		return autoId;
	}

	public void setAutoId(Long autoId) {
		this.autoId = autoId;
	}
	
	@NotNull(message="组织ID不能为空")
	public Long getOrgId() {
		return orgId;
	}

	public void setOrgId(Long orgId) {
		this.orgId = orgId;
	}
	
	@NotBlank(message="组织编码不能为空")
	@Size(min=0, max=10, message="组织编码长度不能超过 10 个字符")
	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	
	@NotBlank(message="组织名称不能为空")
	@Size(min=0, max=30, message="组织名称长度不能超过 30 个字符")
	public String getOrgName() {
		return orgName;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}
	
	@NotNull(message="分类ID不能为空")
	public Long getInventoryClassId() {
		return inventoryClassId;
	}

	public void setInventoryClassId(Long inventoryClassId) {
		this.inventoryClassId = inventoryClassId;
	}
	
	@NotBlank(message="料品编码不能为空")
	@Size(min=0, max=50, message="料品编码长度不能超过 50 个字符")
	public String getInvCode() {
		return invCode;
	}

	public void setInvCode(String invCode) {
		this.invCode = invCode;
	}
	
	@NotBlank(message="料品名称不能为空")
	@Size(min=0, max=255, message="料品名称长度不能超过 255 个字符")
	public String getInvName() {
		return invName;
	}

	public void setInvName(String invName) {
		this.invName = invName;
	}
	
	@Size(min=0, max=255, message="存货代码长度不能超过 255 个字符")
	public String getInvAddCode() {
		return invAddCode;
	}

	public void setInvAddCode(String invAddCode) {
		this.invAddCode = invAddCode;
	}
	
	@Size(min=0, max=500, message="规格型号长度不能超过 500 个字符")
	public String getInvSpec() {
		return invSpec;
	}

	public void setInvSpec(String invSpec) {
		this.invSpec = invSpec;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	
	@Size(min=0, max=100, message="存货属性长度不能超过 100 个字符")
	public String getInvAttribute() {
		return invAttribute;
	}

	public void setInvAttribute(String invAttribute) {
		this.invAttribute = invAttribute;
	}
	
	public Integer getPackageQty() {
		return packageQty;
	}

	public void setPackageQty(Integer packageQty) {
		this.packageQty = packageQty;
	}
	
	public BigDecimal getOverQty() {
		return overQty;
	}

	public void setOverQty(BigDecimal overQty) {
		this.overQty = overQty;
	}
	
	public BigDecimal getOverRate() {
		return overRate;
	}

	public void setOverRate(BigDecimal overRate) {
		this.overRate = overRate;
	}
	
	@Size(min=0, max=125, message="产地/厂牌长度不能超过 125 个字符")
	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}
	
	public Long getInvMasterUnitGroupId() {
		return invMasterUnitGroupId;
	}

	public void setInvMasterUnitGroupId(Long invMasterUnitGroupId) {
		this.invMasterUnitGroupId = invMasterUnitGroupId;
	}
	
	public Long getInvMasterUnitId() {
		return invMasterUnitId;
	}

	public void setInvMasterUnitId(Long invMasterUnitId) {
		this.invMasterUnitId = invMasterUnitId;
	}
	
	public Long getInvUnitGroupId() {
		return invUnitGroupId;
	}

	public void setInvUnitGroupId(Long invUnitGroupId) {
		this.invUnitGroupId = invUnitGroupId;
	}
	
	public Long getInvUnitId() {
		return invUnitId;
	}

	public void setInvUnitId(Long invUnitId) {
		this.invUnitId = invUnitId;
	}
	
	public Long getSalesUnitGroupId() {
		return salesUnitGroupId;
	}

	public void setSalesUnitGroupId(Long salesUnitGroupId) {
		this.salesUnitGroupId = salesUnitGroupId;
	}
	
	public Long getSalesUnitId() {
		return salesUnitId;
	}

	public void setSalesUnitId(Long salesUnitId) {
		this.salesUnitId = salesUnitId;
	}
	
	public Long getPurchaseUnitGroupId() {
		return purchaseUnitGroupId;
	}

	public void setPurchaseUnitGroupId(Long purchaseUnitGroupId) {
		this.purchaseUnitGroupId = purchaseUnitGroupId;
	}
	
	public Long getPurchaseUnitId() {
		return purchaseUnitId;
	}

	public void setPurchaseUnitId(Long purchaseUnitId) {
		this.purchaseUnitId = purchaseUnitId;
	}
	
	public Long getPriceUnitGroupId() {
		return priceUnitGroupId;
	}

	public void setPriceUnitGroupId(Long priceUnitGroupId) {
		this.priceUnitGroupId = priceUnitGroupId;
	}
	
	public Long getPriceUnitId() {
		return priceUnitId;
	}

	public void setPriceUnitId(Long priceUnitId) {
		this.priceUnitId = priceUnitId;
	}
	
	public Long getProduceUnitGroupId() {
		return produceUnitGroupId;
	}

	public void setProduceUnitGroupId(Long produceUnitGroupId) {
		this.produceUnitGroupId = produceUnitGroupId;
	}
	
	public Long getProduceUnitId() {
		return produceUnitId;
	}

	public void setProduceUnitId(Long produceUnitId) {
		this.produceUnitId = produceUnitId;
	}
	
	public Long getMaterialUnitGroupId() {
		return materialUnitGroupId;
	}

	public void setMaterialUnitGroupId(Long materialUnitGroupId) {
		this.materialUnitGroupId = materialUnitGroupId;
	}
	
	public Long getMaterialUnitId() {
		return materialUnitId;
	}

	public void setMaterialUnitId(Long materialUnitId) {
		this.materialUnitId = materialUnitId;
	}
	
	public Long getCostUnitGroupId() {
		return costUnitGroupId;
	}

	public void setCostUnitGroupId(Long costUnitGroupId) {
		this.costUnitGroupId = costUnitGroupId;
	}
	
	public Long getCostUnitId() {
		return costUnitId;
	}

	public void setCostUnitId(Long costUnitId) {
		this.costUnitId = costUnitId;
	}
	
	public Long getWeightUnitGroupId() {
		return weightUnitGroupId;
	}

	public void setWeightUnitGroupId(Long weightUnitGroupId) {
		this.weightUnitGroupId = weightUnitGroupId;
	}
	
	public Long getWeightUnitId() {
		return weightUnitId;
	}

	public void setWeightUnitId(Long weightUnitId) {
		this.weightUnitId = weightUnitId;
	}
	
	public BigDecimal getInvUnitWeight() {
		return invUnitWeight;
	}

	public void setInvUnitWeight(BigDecimal invUnitWeight) {
		this.invUnitWeight = invUnitWeight;
	}
	
	public Long getBulkUnitGroupId() {
		return bulkUnitGroupId;
	}

	public void setBulkUnitGroupId(Long bulkUnitGroupId) {
		this.bulkUnitGroupId = bulkUnitGroupId;
	}
	
	public Long getBulkUnitId() {
		return bulkUnitId;
	}

	public void setBulkUnitId(Long bulkUnitId) {
		this.bulkUnitId = bulkUnitId;
	}
	
	public BigDecimal getInvUnitBulk() {
		return invUnitBulk;
	}

	public void setInvUnitBulk(BigDecimal invUnitBulk) {
		this.invUnitBulk = invUnitBulk;
	}
	
	public BigDecimal getInvMinQty() {
		return invMinQty;
	}

	public void setInvMinQty(BigDecimal invMinQty) {
		this.invMinQty = invMinQty;
	}
	
	public BigDecimal getInvMaxQty() {
		return invMaxQty;
	}

	public void setInvMaxQty(BigDecimal invMaxQty) {
		this.invMaxQty = invMaxQty;
	}
	
	public BigDecimal getInvSafeQty() {
		return invSafeQty;
	}

	public void setInvSafeQty(BigDecimal invSafeQty) {
		this.invSafeQty = invSafeQty;
	}
	
	public Long getWarehouseId() {
		return warehouseId;
	}

	public void setWarehouseId(Long warehouseId) {
		this.warehouseId = warehouseId;
	}
	
	public Long getWarehousePositionId() {
		return warehousePositionId;
	}

	public void setWarehousePositionId(Long warehousePositionId) {
		this.warehousePositionId = warehousePositionId;
	}
	
	@Size(min=0, max=1, message="是否批次管理长度不能超过 1 个字符")
	public String getBatchFlag() {
		return batchFlag;
	}

	public void setBatchFlag(String batchFlag) {
		this.batchFlag = batchFlag;
	}
	
	public BigDecimal getLength() {
		return length;
	}

	public void setLength(BigDecimal length) {
		this.length = length;
	}
	
	public BigDecimal getWidth() {
		return width;
	}

	public void setWidth(BigDecimal width) {
		this.width = width;
	}
	
	public BigDecimal getHeight() {
		return height;
	}

	public void setHeight(BigDecimal height) {
		this.height = height;
	}
	
	public BigDecimal getVolume() {
		return volume;
	}

	public void setVolume(BigDecimal volume) {
		this.volume = volume;
	}
	
	@Size(min=0, max=1, message="来源长度不能超过 1 个字符")
	public String getSourceType() {
		return sourceType;
	}

	public void setSourceType(String sourceType) {
		this.sourceType = sourceType;
	}
	
	@Size(min=0, max=64, message="来源ID长度不能超过 64 个字符")
	public String getSourceId() {
		return sourceId;
	}

	public void setSourceId(String sourceId) {
		this.sourceId = sourceId;
	}
	
}